<?php
namespace Weibo\Model;
use Common\Model\BaseModel;
class WeiboForwardModel extends BaseModel {
	
	/**
	 * @author	Baiyu
	 * @param	number	$weibo_id	微博ID
	 * @param	number	$page		要查哪页的转发列表
	 * @param	number	$offset		起始行
	 * @param	number	$limit		取几行
	 * @param	number	$deleted	0为正常状态1为已删除2为作者删除3为系统删除4为举报删除all为全部
	 * @return	array
	 */
	public function getNewidsByWeiboid($weibo_id, $page = 0, $offset = 0, $limit = 50, $deleted = 0){

		$return = array();
		$where = array(
			'weibo_id' => $weibo_id,
		);
		is_numeric($deleted) && $where['deleted'] = $deleted;
		$limit > 200 && $limit = 200;

		//分页机制 page和offset limit二选一
		if ($page) {
			$where['page_index'] = $page;
		} else {
			$this -> limit($offset, $limit);
		}
		
		//查询转发列表
		$data = $this	-> where($where)
						-> order(array('create_time' => 'DESC'))		//TODO 自已实现order机制
						-> select();
		
		foreach ($data as $item) {
			$return[] = $item['new_id'];
		}
		
		return $return;
	}
	
}